package net.luohuasheng.bee.proxy.mybatis.executor.page;

import java.util.List;

public class Page<T> {


    private boolean first;
    private boolean last;
    private long total;
    private List<T> content;

    public Page(long total, List<T> content, Pageable pageable) {
        this.content = content;
        this.total = total == -1 ? content.size() : total;
        this.first = pageable.getPage() == 1;
        this.last = pageable.getPage() * pageable.getRow() >= total;
    }

    public long getTotal() {
        return total;
    }

    public void setTotal(long total) {
        this.total = total;
    }

    public List<T> getContent() {
        return content;
    }

    public boolean isFirst() {
        return first;
    }

    public boolean isLast() {
        return last;
    }

}
